package zuk.clipvuiviet.getdata;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import android.util.Log;

import zuk.clipvuiviet.GetDataFromUrl;
import zuk.clipvuiviet.clipadapter.Clip;

public class SetList {
	List<Clip> listClips = new ArrayList<Clip>();
	public List<Clip> setlist(String tab,String page) {
		try {
			String htmldata = new GetDataFromUrl().getData(tab+page);
			JSONArray jArray = new JSONArray(htmldata);
			for(int i = 0;i<jArray.length();i++){
				JSONObject jSon  = jArray.getJSONObject(i);
				listClips.add(new Clip(jSon.getString("Url"), jSon.getString("ThumbImg"),jSon.getString("Tittle"),jSon.getString("UTube")));
			}
			return listClips;
		} catch (Exception e) {
			Log.e("zuk.clipvuiviet.getdata.SetList", "Exception e");
		}
		return listClips;
	}

}
